//轮播
//jQuery(".slideBox").slide({mainCell: ".bd ul", effect: "leftLoop", autoPlay: true, easing: "easeOutCirc", delayTime: 700});
//轮播宽高
//alert(1);

if (window.innerWidth) {
    winWidth = window.innerWidth;
} else if ((document.body) && (document.body.clientWidth))
{
    winWidth = document.body.clientWidth;
}
if (document.documentElement && document.documentElement.clientWidth)
{
    winWidth = document.documentElement.clientWidth;
}
var win_w = winWidth;
var index = 0;
var tick;
var ul = $(".banner_slide ul");
var ol = $(".banner_slide ol");
var left = $(".left");
var right = $(".right");
var div = $(".banner_slide");
ul.append($(".banner_slide ul li").first().clone());
var li_n = $(".banner_slide ul li").length;
function autofirst() {
    div.css({"width": win_w, "height": win_w / 4.8});
    ul.css({"width": win_w * li_n});
    $(".banner_slide ul li").css({"width": win_w});
}
function autosecond() {
    ul.stop().animate({"left": -win_w * index}, 300);
    $(".banner_slide ol li").eq(index).addClass("select").siblings().removeClass("select");
}
function autothird() {
    if (index < 0) {
        ul.css({"left": -win_w * (li_n - 1)});
        index = li_n - 2;
        autosecond();
    } else
    if (index === li_n - 1) {
        $(".banner_slide ol li").eq(0).addClass("select").siblings().removeClass("select");
    } else if (index > li_n - 1) {
        ul.css({"left": 0});
        index = 1;
    }
    autosecond();
}
$(window).resize(function () {
    if (window.innerWidth) {
        winWidth = window.innerWidth;
    } else if ((document.body) && (document.body.clientWidth))
    {
        winWidth = document.body.clientWidth;
    }
    if (document.documentElement && document.documentElement.clientWidth)
    {
        winWidth = document.documentElement.clientWidth;
    }
    win_w = winWidth;
    autofirst();
    autosecond();
});
autofirst();
$(".banner_slide ol li").click(function () {
    index = $(this).index();
    autosecond();
});
$(".banner_slide ol li").hover(function () {
    index = $(this).index();
    autosecond();
});
left.click(function () {
    index--;
    autothird();
});
right.click(function () {
    index++;
    autothird();
});
ul.hover(function () {
    clearInterval(tick);
}, function () {
    tick = setInterval(function () {
        right.click();
    }, 2500);
});
left.hover(function () {
    clearInterval(tick);
}, function () {
    tick = setInterval(function () {
        right.click();
    }, 2500);
});
right.hover(function () {
    clearInterval(tick);
}, function () {
    tick = setInterval(function () {
        right.click();
    }, 2500);
});
tick = setInterval(function () {
    right.click();
}, 2500);

////热门诊所hover事件
$(".home-clinic ul li").hover(function () {
    $(this).parent().find("li").removeClass("active");
    $(this).addClass("active");
}, function () {
    $(this).removeClass("active");
});

